<nz-modal [(nzVisible)]="visible" [nzTitle]="detailItem.id ? '修改学校' : '新增学校'" [nzMaskClosable]="false"
  (nzOnCancel)="onCancel()" [nzFooter]="nzModalFooter" nzWidth="500">
  <form nz-form #eitorForm="ngForm">
    <nz-form-item class="mb-md">
      <nz-form-label [nzSpan]="6" nzRequired>学校名称</nz-form-label>
      <nz-form-control [nzSpan]="18" [nzErrorTip]="erroraccout"
        [nzValidateStatus]="name.invalid && (name.dirty || name.touched) ? 'error' : ''" nzHasFeedback>
        <input #name="ngModel" autocomplete="off" nz-input [(ngModel)]="detailItem.name" name="name" placeholder="学校名称"
          required />
        <ng-template #erroraccout let-control>
          <ng-container *ngIf="name.hasError('required')">
            请输入学校名称!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item class="mb-md">
      <nz-form-label [nzSpan]="6" nzRequired>学校国家</nz-form-label>
      <nz-form-control [nzSpan]="18" [nzErrorTip]="erroracountry"
        [nzValidateStatus]="country.invalid && (country.dirty || country.touched) ? 'error' : ''" nzHasFeedback>
        <input #country="ngModel" autocomplete="off" nz-input [(ngModel)]="detailItem.country" name="country"
          placeholder="学校国家" required />
        <ng-template #erroracountry let-control>
          <ng-container *ngIf="country.hasError('required')">
            请输入学校国家!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item class="mb-md">
      <nz-form-label [nzSpan]="6" nzRequired>学校详细地址</nz-form-label>
      <nz-form-control [nzSpan]="18" [nzErrorTip]="erroradetailed_address"
        [nzValidateStatus]="detailed_address.invalid && (detailed_address.dirty || detailed_address.touched) ? 'error' : ''"
        nzHasFeedback>
        <input #detailed_address="ngModel" autocomplete="off" nz-input [(ngModel)]="detailItem.detailed_address"
          name="detailed_address" placeholder="学校详细地址" required />
        <ng-template #erroradetailed_address let-control>
          <ng-container *ngIf="detailed_address.hasError('required')">
            请输入学校详细地址!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>


    <nz-form-item class="mb-md">
      <nz-form-label [nzSpan]="6" nzRequired>学校基本信息</nz-form-label>
      <nz-form-control [nzSpan]="18" [nzErrorTip]="erroressential_information"
        [nzValidateStatus]="essential_information.invalid && (essential_information.dirty || essential_information.touched) ? 'error' : ''"
        nzHasFeedback>
        <textarea #essential_information="ngModel" autocomplete="off" nz-input
          [(ngModel)]="detailItem.essential_information" name="essential_information"
          [nzAutosize]="{ minRows: 3, maxRows: 6 }" placeholder="学校基本信息" required></textarea>
        <ng-template #erroressential_information let-control>
          <ng-container *ngIf="detailed_address.hasError('required')">
            请输入学校基本信息!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>


    <nz-form-item class="mb-md">
      <nz-form-label [nzSpan]="6" nzRequired>学校拥有专业</nz-form-label>
      <nz-form-control [nzSpan]="18" [nzErrorTip]="erroremajorIds"
        [nzValidateStatus]="majors.invalid && (majors.dirty || majors.touched) ? 'error' : ''" nzHasFeedback>
        <app-major-select #majors="ngModel" autocomplete="off" [(ngModel)]="detailItem.majors" name="majors"
          placeholder="学校基本信息" required></app-major-select>
        <ng-template #erroremajorIds let-control>
          <ng-container *ngIf="majors.hasError('required')">
            请选择学校拥有专业!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>
  </form>
  <ng-template #nzModalFooter>
    <button nz-button nzType="default" (click)="onCancel()">取消</button>
    <button nz-button nzType="primary" [nzLoading]="loading" (click)="validate(true)"
      [acl]="['SCHOOL_CREATE', 'SCHOOL_UPDATE']">
      确定
    </button>
  </ng-template>
</nz-modal>
